import Vue from 'vue'
import Router from 'vue-router'
import Index from './views'
const Login = () => import(/* webpackChunkName: "login" */ './views/login/Login')
const Home = () => import(/* webpackChunkName: "home" */ './views/home')
const Projects = () => import(/* webpackChunkName: "projects" */ './views/projects')
const ProjectList = () => import(/* webpackChunkName: "projects" */ './views/projects/home')
const ProjectSet = () => import(/* webpackChunkName: "projects" */ './views/projectSet')
const Sets = () => import(/* webpackChunkName: "projects" */ './views/projectSet/sets')
const Clear = () => import(/* webpackChunkName: "projects" */ './views/projectSet/clear')
const Member = () => import(/* webpackChunkName: "projects" */ './views/projectSet/member')
const System = () => import(/* webpackChunkName: "system" */ './views/system')
const User = () => import(/* webpackChunkName: "system" */ './views/system/user')
const Dep = () => import(/* webpackChunkName: "system" */ './views/system/dep')
const Log = () => import(/* webpackChunkName: "system" */ './views/system/log')
const Role = () => import(/* webpackChunkName: "system" */ './views/system/role')
const Relate = () => import(/* webpackChunkName: "system" */ './views/system/role/relate')
const Menu = () => import(/* webpackChunkName: "system" */ './views/system/menu')

Vue.use(Router)

export default new Router({
    mode: 'hash',
    base: process.env.BASE_URL,
    routes: [
        {
            path: '/',
            name: 'index',
            component: Index,
            redirect: 'home',
            children: [
                { path: 'home', meta: { requireAuth: true }, name: '首页', component: Home },
                {
                    path: 'projects',
                    name: '项目管理',
                    component: Projects,
                    redirect: '/projects/projectList',
                    children: [
                        { path: 'projectList', meta: { requireAuth: true }, name: '', component: ProjectList },
                        {
                            path: 'projectSet',
                            component: ProjectSet,
                            redirect: '/projects/projectSet/sets',
                            children: [
                                { path: 'sets', meta: { requireAuth: true }, name: '项目设置', component: Sets },
                                { path: 'member', meta: { requireAuth: true }, name: '成员管理', component: Member },
                                { path: 'clear', meta: { requireAuth: true }, name: '临时表清理', component: Clear }
                            ]
                        }
                    ]
                },
                {
                    path: 'system',
                    name: '系统管理',
                    component: System,
                    redirect: '/system/user',
                    children: [
                        { path: 'user', meta: { requireAuth: true }, name: '用户管理', component: User },
                        {
                            path: 'role',
                            name: '角色管理',
                            component: Role,
                            children: [
                                { path: 'relate', meta: { requireAuth: true }, name: '关联用户', component: Relate }
                            ]
                        },
                        { path: 'menu', meta: { requireAuth: true }, name: '菜单管理', component: Menu },
                        { path: 'dep', meta: { requireAuth: true }, name: '部门管理', component: Dep },
                        { path: 'log', meta: { requireAuth: true }, name: '日志管理', component: Log }
                    ]
                }
            ]
        },
        { path: '/login', name: '登录', component: Login }
    ]
})
